---
title: OpenCV Tools
---

## Code

```python cookbook/tools/opencv_tools.py
from agno.agent import Agent
from agno.tools.opencv import OpenCVTools

agent = Agent(
    instructions=[
        "You are a computer vision assistant that can capture images and videos",
        "Use the webcam to take photos or record videos as requested",
        "Provide clear feedback about capture operations",
    ],
    tools=[OpenCVTools()],
    markdown=True,
)

agent.print_response("Take a photo using the webcam")
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set your API key">
    ```bash
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="Install libraries">
    ```bash
    pip install -U opencv-python openai agno
    ```
  </Step>

  <Step title="Run Agent">
    <CodeGroup>
    ```bash Mac
    python cookbook/tools/opencv_tools.py
    ```

    ```bash Windows
    python cookbook/tools/opencv_tools.py
    ```
    </CodeGroup>
  </Step>
</Steps>
